package com.ht.temp.service.impl;

import com.ht.temp.entity.DayReport;
import com.ht.temp.mapper.DayReportMapper;
import com.ht.temp.service.IDayReportService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author mayke_zhou
 * @since 2018-12-24
 */
@Service
public class DayReportServiceImpl extends ServiceImpl<DayReportMapper, DayReport> implements IDayReportService {

    @Autowired
    private DayReportMapper dayReportMapper;

    @Override
    public List<DayReport> getDayReportByMonths(Integer deviceId, String startTime, String endTime) {
        System.out.println(startTime.substring(0,startTime.length()-9)+"/"+endTime.substring(0,startTime.length()-9));
        String sTime = startTime.substring(0,startTime.length()-9);
        String eTime = endTime.substring(0,startTime.length()-9);
        return dayReportMapper.selectDayReportByMonths(sTime,eTime,deviceId);
    }

    @Override
    public List<DayReport> selectMouthReport(String selectMouth, Integer deviceId) {
        selectMouth=selectMouth+"-01";
        return dayReportMapper.selectMouthReport(selectMouth,deviceId);
    }


}
